Memory controller for non-homogenous memory system

ABSTRACT

A memory controller includes a first memory interface adapted to be coupled to one or more first memory devices of a first memory type having a first set of attributes, and a second memory interface adapted to be coupled to one or more second memory devices of a second memory type having a second set of attributes. The first and second sets of attributes have at least one differing attribute. The controller also includes interface logic configured to direct memory transactions having a predefined first characteristic to the first memory interface and to direct memory transactions having a predefined second characteristic to the second memory interface. Pages having a usage characteristic of large volumes of write operations may be mapped to the one or more first memory devices, while pages having a read-only or read-mostly usage characteristic may be mapped to the one or more second memory devices.

TECHNICAL FIELD

The disclosed embodiments relate generally to memory systems andmethods, and in particular to a memory controller for a non-homogeneousmemory system.

BACKGROUND

Computer program code and data needed for execution of a process on acomputer system typically resides in the computer system's main memory.The main memory of a computer system (e.g., DRAM), however, may not belarge enough to accommodate the needs of the entire process. Virtualmemory is a commonly used technique that allows processes that are notstored entirely within main memory to execute by means of an automaticstorage allocation scheme. The term virtual memory refers to theabstraction of separating logical memory (i.e., memory as seen by theprocess) and physical memory (i.e., memory as seen by the processor).The virtual memory abstraction is implemented by using secondary storageto augment main memory in a computer system. Pages of data and programcode are transferred from secondary storage to main memory as the dataand program is needed by an executing process, and pages of data andprogram code are evicted from main memory and written to secondarystorage when room is needed in main memory to store other pages of dataand program code. The process of moving pages of data and program codeback and forth between main memory and secondary storage is called by avariety of names, including swapping, paging, and virtual memorymanagement.

In a virtual memory system, a program generated address or logicaladdress, which typically includes a logical page number plus thelocation within that page, is interpreted or mapped onto an actual(i.e., physical) main memory address by the operating system using anaddress translation function. If the page is present in main memory, theaddress translation function substitutes the physical page frame numberfor the logical number. If the address translation function detects thatthe page requested is not present in main memory, a fault occurs and thepage is read into a main memory page frame from secondary storage. Thisaddress translation function can be accomplished by using a directlyindexed table, commonly referred to as a “page table,” which identifiesthe location of the program's pages in main memory. If the page tableindicates that a page is not resident in main memory, the addresstranslation function issues a page fault to the operating system. Thiscauses execution of the program which required the page to be suspendeduntil the desired page can be read from secondary storage and placed inmain memory. Further background regarding virtual memory management canbe found in Richard W. Carr, Virtual Memory Management, UMI ResearchPress, Ann Arbor, Mich., 1984.

Portable computing devices typically use a single type of memory deviceat each level in their memory hierarchy. For example, portable computers(e.g., notebook computers) typically have at three or more hierarchicallevels of memory, including secondary storage, main memory and cachememory. Often there are two or more levels of cache memory. Secondarystorage is typically implemented with magnetic disk storage (oftencalled hard disk storage). Main memory is typically implemented withDynamic Random Access Memory (DRAM), and cache is typically implementedusing Static Random Access Memory (SRAM). In some portable computers,such as personal digital assistants (PDA'S), the secondary memory isimplemented using flash memory instead of magnetic disk storage.

DRAM has a near-optimal combination of operational attributes forimplementing main memory. These attributes include, without limitation,low cost (only magnetic disk storage has a lower per-bit cost), low readtime (the read access time is within an order of magnitude of that ofthe highest speed SRAM), low write time that is the same or similar tothe read access time, and unlimited endurance (i.e., the storage cellcan be rewritten an unlimited number of times).

SUMMARY

A memory controller for a non-homogeneous memory system is configurableto facilitate page operations between a virtual memory address space andphysical pages of memory devices in the memory system. The memorydevices, which collectively form the main memory of a computer orcomputer controlled device, include two or more memory device types(e.g., DRAM, Flash) with different attributes. A tag or other datastructure associated with each page includes data indicative of thememory device, or type of memory device, in which the page is to bestored whenever the page is brought into main memory.

In some embodiments, virtual memory pages that are read-write,especially pages that may be written a large number of times, are mappedto a first portion of main memory implemented using one or more memorydevices of a first type, while virtual memory pages that are read-onlyare mapped to a second portion of main memory, implemented using one ormemory devices of a second type. In some embodiments, at least somevirtual memory pages expected to be written to only a small number oftimes (i.e., pages having a “read mostly” usage characteristic) aremapped to the second portion of main memory.

In some embodiments, the second type of memory device has limitedendurance while the second type of memory device has unlimitedendurance. (For example, various types of NOR Flash memory have cycleendurances ranging from 1,000 cycles to 100,000 write cycles.) In someembodiments, the second type of memory device has substantially longerwrite time than read time, while the first type of memory device hassubstantially similar read and write time.

In some embodiments, the memory controller includes a write cache, usedto temporarily store write data directed to pages in the second type ofmemory device. In some embodiments, an endurance table is adapted totrack page operations directed to memory devices having limitedendurance.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a system having non-homogeneous mainmemory.

FIG. 2 is a diagram illustrating an embodiment of a data structure formanaging page operations in a non-homogeneous memory system.

FIG. 3 is a flow diagram of an embodiment of a non-homogeneous memoryprocess.

FIG. 4 is another block diagram of a computer system havingnon-homogenous main memory.

DESCRIPTION OF EMBODIMENTS DRAM and Flash Memory Attributes

While DRAM has many advantages over other memory device types forimplementing main memory in a computer system, it also has somedisadvantages. For example, DRAM storage cells must be refreshed tomaintain their contents even when the DRAM is not being accessed.Additionally, when power is removed from the system, the DRAM storagecells loose their stored information. In other words, data storage byDRAM devices is volatile. In the future, it is likely that theattributes needed by computer systems, such as portable computersystems, will no longer be optimally satisfied by DRAM devices. Indeed,it is possible that other memory device types (e.g., Flash memory) willhave a cost per bit that is comparable or lower than DRAM memory. Inaddition, these alternative memory device types may have differentattributes than DRAM. For example, Flash memory attributes include,without limitation, low cost (i.e., comparable to DRAM), low read time(i.e., the read access time is within an order of magnitude of that ofthe highest speed SRAM in the cache hierarchy), large write time (i.e.,the write access time is large compared to the DRAM write access time),limited endurance (i.e., the storage cell may be written a limitednumber of times), non-volatile (i.e., Flash memory retains its contentswithout requiring periodic refreshing), and zero standby power (i.e.,when power is removed from the system, Flash memory retains the storedinformation). The Flash memory attributes of low read time andnon-volatility make Flash memory devices particularly attractive for usein portable computing applications. As explained below, however,replacing the magnetic disk storage with Flash memory is a suboptimaluse of Flash memory.

System Overview

FIG. 1 is a block diagram of a computer system 100 having anon-homogeneous main memory 101. The computer system 100 is includes amemory controller 102, main memory 101, one or more processors 108 andsecondary storage 100 (e.g., a hard disk unit). In many embodiments,cache memory 103 forms a fastest level in the memory hierarchy, withmain memory 101 and secondary storage 110 comprising two other levels ofthe memory hierarchy. In some embodiments, two or more levels of cachememory are provided, resulting a memory hierarchy with four or morelevels. In some embodiments, the processor 108, I/O controller 126 andmemory controller 102 may be separate components, while in otherembodiments they may reside on a common component.

Main Memory

The main memory 101 includes a first portion 104 implemented with one ormore memory devices of a first type (e.g., DRAM), and a second portion106 implemented with one or more memory devices of a second type (e.g.,NOR Flash, often simply called Flash memory). The main memory 101 storesprograms and data used by processor 108 during execution of thoseprograms.

Data can be distributed among the first and second portions 104, 106 ofmain memory 101 as well as secondary storage 110 in a manner designed toprovide fast access to the data and programs that are most frequentlyused. In some embodiments, this distribution may be governed, at leastin part, by a memory management policy implemented by the system 100.

The memory devices in the first and second portions 104, 106 of mainmemory are coupled to the memory controller 102 via memory interfaces112 and 114, respectively. The memory devices in portion 104 have one ormore attributes that differ from the attributes of the memory devices inportion 106. Examples of such attributes are: the ratio of write accesstime to read access time, volatility, and endurance.

For example, when the second portion 106 is implemented using Flashmemory devices, the memory devices in the second portion have a writeaccess time that is substantially greater than their read access time.For Flash memory, the write access time is sometimes called theerase-write time, because writing new data to a Flash memory devicerequires erasing the corresponding block of the memory device before newdata is written to the memory device. A typical NOR Flash memory devicemay have a read access time of less than 100 ns, and an erase-write timeof more than 1 millisecond. Thus, the ratio of write access time to readaccess time may exceed 10,000 to 1, and will typically be greater than100 to 1. This attribute differs from the write access time of, forexample, DRAM, which is typically about the same as the read access timeof DRAM devices. For example, the read access time and write access timeof a DRAM device are typically both less than 100 ns, and often both arebetween 20 ns and 40 ns. The ratio of write access time to read accesstime of DRAM devices is generally less than 4 to 1, and is typicallyless than 2 to 1. The first portion 104 and second portion 106 of mainmemory 101 occupy distinct portions of the main memory address space,sometimes called the physical memory address space, but share the samevirtual memory address space used by programs during their execution bythe processor 108.

In some embodiments, the first portion 104 of main memory 101 isimplemented using one or more DRAM memory devices, and the secondportion 106 of main memory 101 is implemented using one or more Flashmemory devices (e.g., NOR Flash memory devices). In other embodiments,one or both portions of main memory 101 may be implemented using othertypes of memory devices. In some embodiments, main memory 101 may beimplemented using with more than two portions, implemented using morethan two types of memory devices. For each such arrangement, the memorycontroller 102 can be configured to exploit the different attributes ofthe memory device types in the respective portions of main memory so asto improve one or more aspects of memory system performance.

In some embodiments, an attribute of the memory devices in the first andsecond portions that differ.

Secondary Storage System

The secondary storage system 110 is coupled to the memory controller 102via processor interface logic 122, I/O controller 126 and communicationchannel 124 (sometimes called bus 124). The secondary storage system 110can be any type of file storage device, system or network, includingwithout limitation, hard disk units, optical disks, Universal Serial Bus(USB) Flash, storage area networks (SANs), a wireless connection to afile server system or wireless local area network (WLAN), and any otherfile storage device, system or network having a file structure forstoring virtual pages. In some embodiments, the second storage system110 is a non-volatile repository for user and system data and programs.Uses of the secondary storage system 110 include storing various formsof programs (e.g., source, object, executable) and temporary storage ofvirtual pages (e.g., swap space). Information stored in the secondarystorage system 110 may be in a variety of forms, including readable textand raw data (e.g., binary).

The secondary storage system 110 includes a file management system (notshown) for providing mapping between the logical and physical views of afile via one or more services and the I/O controller 126. Some basicservices of the file management system include keeping track of files,I/O support (e.g., providing a transmission mechanism to and from mainmemory), management of the secondary storage system 110, sharing I/Odevices, and providing protection mechanisms for the files and otherinformation.

Page Table

A full description of virtual memory management and page table operationis outside the scope of this document, and furthermore is wellunderstood by those of ordinary skill in the art of data processordesign. Only those aspects of virtual memory management required fordescription of the present invention are presented here.

In embodiments that use virtual memory paging techniques, a page tableis used to indicate the location of each logical page, either in mainmemory 101 or secondary storage 110. While the page table 130 is shownin FIG. 1 as being stored in secondary storage 110, portions of the pagetable may be stored in main memory 101, and furthermore the entries ofthe page table currently in use are stored within the processor 108 in apage table cache, sometimes called the translation look-aside buffer(TLB) 132. The page table entries in the TLB 132 map virtual memorypages to physical page frames in main memory. When the TLB 132 lacks apage table entry required for mapping a virtual memory address to aphysical main memory address, an interrupt process is automaticallyinvoked to bring the required page table entry into the TLB 132. If thevirtual memory page containing the virtual memory address has not yetbeen assigned to a physical main memory page, one is assigned, and thepage table entry is updated to reflect the assignment. Furthermore, ifnecessary, the virtual memory page may be initialized or swapped in fromsecondary memory.

In some embodiments, each page table entry in the TLB 132 includes ausage field 134 that designates the portion of main memory 101 to whichthe corresponding virtual memory page is mapped. In some embodiments,the usage field 134 of each entry comprises the most significant bit(MSB), or bits (MSBs), of the physical memory address of the page. Inother embodiments, the usage field 134 does not comprise the MSB or MSBsof the page's physical memory address, but does specify the portion(104, 106) of the main memory 101 to which the page is mapped. In FIG.1, a usage field value of “A” represents a page mapped to the firstportion 104 of main memory 101, while a value of “B” represents a pagemapped to the second portion 106 of main memory 101.

Endurance Table

NOR Flash memory devices typically have different granularity for readand write operations. In particular, the minimum unit for reading datafrom Flash memory may be a word (e.g., 16 bits) while the minimum unitfor writing data to Flash memory is typically significantly larger thanthe minimum unit for reading, and is called either a block or a group ofmemory cells. In some Flash memory devices, each block includes between1024 and 65,536 words, with blocks typically containing between 4 k(4096) and 32 k (32,768) words. Some Flash memory devices have blocks orgroups of memory cells of two or more distinct sizes.

Furthermore, it may be noted that a page, which is the basic unit ofdata or storage in a virtual memory system is typically, but notnecessarily, of a different size than a block in a Flash memory device.Thus, a page may be stored in a plurality of blocks, or one block couldstore multiple pages, or each page could be stored in a single block.

In embodiments in which a portion of main memory 101 is implementedusing memory devices having limited endurance (e.g., Flash memorydevices), an endurance table 128 is used to keep track of the number ofwrite operations to each block of memory cells in the correspondingportion of main memory. In some embodiments, the endurance table 128contains a distinct entry for each block of memory cells for which awrite operations count is to be maintained. In other words, theendurance table 128 has a distinct entry for each distinct block ofmemory cells in each of the memory devices in the second portion of mainmemory.

In some embodiments, the endurance table is stored in secondary storage110, to ensure that the endurance table 128 is retained when systempower is turned off. The “endurance” of a memory device is defined asthe maximum number of erase-write cycles that the memory device cansupport, which is a parameter typically included on data sheets foroff-the-shelf memory non-volatile memory devices. The count values inthe endurance table 128 are updated, maintained and checked to ensurethat the endurance limit of the device is not exceeded (e.g., 10 Kcycles). For example, prior to performing a write operation on thesecond memory device 106, the operating system can check erase-writecycle count data stored in the endurance table 128 to determine whetherto complete the write operation, or perform a contingency operation(e.g., write to a different block of memory or to a different portion ofmain memory).

In some embodiments, the erase-write cycle count for a block of memorycells is decremented by the memory controller 102 after each erase-writeoperation. Prior to each erase-write operation the cycle count for theblock to be written is compared with zero (or other threshold value). Ifthe count is equal to zero, the endurance limitation of the memorydevice has been reached with respect to the memory block correspondingto the count. In other embodiments, the erase-write cycle count iseither incremented or decremented, and the resulting value is comparedwith a threshold value to determine if the endurance limitation has beenreached. More generally, in these embodiments, the memory controller 102utilizes an endurance table counting mechanism to ensure that theendurance limitation of each block of memory cells in the second portion106 of main memory 101 (i.e., the portion implemented using memorydevices of limited endurance) is not exceeded.

In other embodiments, an endurance table 128 is not employed. In suchembodiments, other measures are employed to ensure that the endurancelimitation of the memory devices in a portion 106 of main memory 101 arenot exceeded. For instance, pages initially mapped to limited endurancememory devices may be remapped to unlimited endurance memory deviceswhen predefined remapping conditions are satisfied. Such predefinedremapping conditions may include conditions relating to write operationsto a page initially mapped to a page frame in a limited endurance memorydevice. For instance, the predefined remapping condition for a page maybe satisfied when more than N write operations are performed on the page(e.g., where N is a predefined non-negative integer value).

Processor

The processor 108 is coupled to the memory controller 102 via bus 124and processor interface logic 122. The processor 108 can be anyprocessor suitable for memory management and/or control, includingwithout limitation, a central processing unit (CPU), a memory managementchip or chip-set, an on-chip memory management unit (CPU) and the like.In some embodiments, the processor 108 includes a page table cache 132(e.g., a translation look-aside buffer or TLB) for storing the physicaladdress translations of recently referenced logical addresses.

Memory Controller

The memory controller 102 includes memory interfaces 112, 114 forcoupling the memory controller 102 to the memory devices in two or moredistinct portions (104, 106) of main memory 101, and processor interfacelogic 122. The memory interfaces 112 and 114 may include signalconditioning circuitry and other devices for transmitting addresses,data, and control signals to and from the memory devices in main memoryportions 104 and 106.

In some embodiments, the first memory interface 112 includes circuitryfor powering down, or reducing power to the memory devices in the firstportion 104 of main memory 101 in response to a power reduction commandfrom the memory controller 102 or the processor 108. Similarly, in someembodiments, the second memory interface 114 includes circuitry forpowering down, or reducing power to the memory devices in the secondportion 106 of main memory 101 in response to a power reduction commandfrom the memory controller 102 or the processor 108.

In some embodiments, the memory controller 102 also includes a writecache 116 and address compare logic 118, both coupled to a communicationpath 136 (ReadY path). In some embodiments, the memory controller 102includes an endurance counter and cache 120 coupled to path 136 (ReadYpath). The path 136 is coupled to the bus 124 via the processorinterface logic 122. The processor interface logic 122 may includesignal conditioning circuitry and other devices for transmitting data,addresses and control signals to and from the bus 124. For example, theprocessor interface logic 122 may include decoding logic for decodingone or more bits of a physical address to determine whether the first orsecond portion of main memory will receive a memory access transaction,as described below with respect to FIG. 2.

In some embodiments, the ReadY path 136 couples the second portion 106of main memory 101 to a streaming-type prefetch buffer 138. If thememory devices in the second portion 106 of main memory are non-volatilememory devices (e.g., Flash memory devices), it is likely that much ofthe information contained in those memory devices will be of a medianature and therefore access to that information could be made faster bythe streaming-type prefetch buffer 138. The use of the prefetch buffer138 could also save power, since the memory devices in the secondportion 106 of main memory could be powered down in between prefetchaccesses, particularly if the system was performing a single applicationlike media playback.

It should be apparent that the memory controller 102 would typicallyinclude other hardware/software components (e.g., clock circuits,buffers, switches, power management circuits. etc.), which are not shownin FIG. 1 for clarity purposes. Such components are well-known in thefield of memory system management and control.

Endurance Cache

The endurance counter and cache 120 stores the most recently usedentries of the endurance table 128, and updates those entries (bydecrementing or incrementing them) when a corresponding block writeoperation is performed. For example, prior to a write operation to aphysical page in Flash memory address space, it may be necessary tocheck the endurance cache 120 to determine whether the endurance limithas been exceeded. If it is determined that the endurance limit has beenexceeded, then the operating system can abort the write operation and/orperform a remedial operation (e.g., remapping the page in question toanother memory block in the same portion of main memory, or remappingthe page in question to a page frame in another portion of main memory).

Note that it is possible that the smallest set of storage cells (e.g., ablock) that can be written to a memory device in the second portion 106of main memory is smaller than the number of storage cells that arewritten by a single write transaction by the processor 108 (e.g., aword). If this is the case, a read-modify-write operation can beperformed by the memory controller 102. The read-modify-write operationincludes reading out the group, modifying the data corresponds to theword (or other unit) written by the processor, and then writing thegroup back to the memory device. Alternately, a write cache (describedelsewhere in this document) can be used to accumulate written data,which is then written to the memory device at appropriate times (e.g.,when data in the write cache requires flushing).

Write Cache Structure & Operation

A write cache 116 may be used in embodiments in which a portion of mainmemory 101 is implemented using memory devices (such as Flash memorydevices) having either limited endurance, or write access time that issignificantly longer than read access time, or both. The write cache 116may be used both to hide the write access latency of such memorydevices, and also to reduce write cycles to memory devices havinglimited endurance. When a block B₁ of a physical page B in a memorydevice in the second portion 106 of main memory 101 is to be written(e.g., because the processor 108 has written new data to one or morewords in the block B₁), the write data is placed in a correspondingblock B₁′ of the write cache 116.

In some embodiments, the write cache 116 is organized in an associativemanner (e.g., fully associative, multiple set associative, etc.). Thiscache organization, as opposed to a directly mapped (one set) cache,reduces the number of write operations to the memory device(s) in thesecond portion 106 of main memory 101 caused by cache storage conflictsbetween a current write operation and data previously written to thewrite cache 116. For instance, if the write cache 116 is an N-way setassociative cache, then data for up to N blocks having the same addresstag can be stored in the write cache 116 before a block must be flushedfrom the write cache 116 to a corresponding memory device in the secondportion 106 of main memory. If the write cache 116 is fully associative,then a write operation by the processor 108 will cause a block to beflushed from the write cache 116 only if the write cache is full (i.e.,all the blocks in the write cache 116 are occupied by valid write data),and the processor attempts to write to another block (herein called thecurrent block) not present in the write cache 116.

Whenever the write cache 116 is unable to store data written by theprocessor 108 without performing a flush operation, one of a number ofremedial operations must be performed: either one or more blocks must beflushed from the write cache 116 to one or more memory devices in thesecond portion 106 of main memory 101, or the current block must bewritten directly to a memory device in the second portion 106 of mainmemory 101, or a page of data mapped to the second portion 106 of mainmemory 101 must be remapped and copied to the first portion 104 of mainmemory 101, thereby freeing the corresponding blocks in the write cache116. In other embodiments, other remedial actions may be taken.

In one embodiment, the remedial operation performed is to flush one ormore blocks from the write cache 116 to one or more memory devices inthe second portion 106 of main memory 101. In another embodiment, theremedial operation performed depends on an endurance count associatedwith either the current block or the block to be flushed from the writecache 116. If the endurance count indicates a number of write operationsabove a threshold level, the remedial action performed is to remap andcopy the corresponding page to a page frame in the first portion 104 ofmain memory 101. Otherwise, the remedial action performed is theaforementioned flush operation. As already indicate, in otherembodiments, other remedial actions may be taken.

When a write operation to a current block B₁ is received by the memorycontroller 102, the address compare logic 118 compares the addressagainst addresses of the corresponding blocks in the write cache 116. Ifthere is a match, the new write data is written back to block B₁′ in thewrite cache 116. If there is no match, an available block in the writecache 116 becomes block B₁′ and is written with the data.

The address compare logic 118 includes various logic devices configuredto compare the physical addresses issued by the processor 108 with theaddress tags of entries in the write cache 116, and to determine whendata corresponding to the specified address is present in the writecache 116. The address compare logic 118 may be considered to be anintegral part of the write cache 116.

If a read operation to block B₁ in the second portion 106 of main memory101 is received, the physical address is compared against physicaladdresses of blocks in the write cache 116. This comparison may beperformed by the address compare logic 118. If there is a match, thecontents of block B₁′ in the write cache 116 are returned via the ReadXpath 137 shown in FIG. 1. If there is no match, the contents of block B₁in a memory device in the second portion 106 of main memory 101 isreturned via the ReadY 136 path shown in FIG. 1.

Power State Transitions

In some embodiments, the system 100 operates in at least two powermodes: normal mode and low power (standby) mode. In low power mode, thefirst portion 104 of main memory 101 is completely disabled (e.g., poweris removed). When transitioning to low power mode, all pages currentlymapped to page frames in the first portion 104 of main memory arepreferably swapped back out to secondary storage 110. When the processor108 thereafter requires use of any page not in main memory 101, the pagewill be mapped to a page frame in the second portion 106 of main memory101.

In low power mode, a limited set of application and/or operating systemprocesses can be executed using only the second portion 106 of mainmemory 101, together with the write cache 116. Preferably, theapplication and operating system processes are restricted fromperforming write operations that exceed the capacity and endurancelimitations of the memory devices in the second portion 106 of mainmemory. If these constraints can be satisfied, then the system 100 maytransition into a low power mode in which the first portion 104 of mainmemory 101 is not drawing power, and the second portion 106 of mainmemory 101 is drawing very little power. If the memory devices of thesecond portion 106 of main memory 101 are non-volatile, and all power isremoved from main memory 101, the contents of the memory devices in thesecond portion 106 of main memory 101 can be retrieved once power isrestored, i.e., it is not necessary to restore the contents of the pagesmapped to the second portion 106 of main memory 101 from secondarystorage 110.

FIG. 4 provides another view of the system 100. The system includes mainmemory 101 and secondary storage, shown here in aggregate. The systemalso includes one more processors (CPU(s) 108) and may optionallyinclude a user interface 400 (e.g., having a display 402 and keyboard404 or other user interface devices) and may optionally include anetwork interface 406. These components may be interconnected by one ormore busses or other interconnect mechanisms 124.

The system's memory 101/110 stores computer programs and data, includingan operating system 410, which includes a virtual memory managementmodule or procedures 412, as well as application programs 432. Thevirtual memory management module 412 include instructions or a module414 for page table management, such as for creating and updating thepage table entries in the page table 130. In some embodiments, the pagetable management module or instructions 414 include instructions 416 forusage based page mapping. In particular, the usage based page mappinginstructions or module 416 include instructions for setting the usagefield 134 in at least a plurality of page table entries based on actualor expected usage of the corresponding pages. As indicated elsewhere, insome embodiments, pages containing computer program code may beinitially mapped to a portion of main memory reserved for pages that areeither read-only or are expected to have a “read mostly” usagecharacteristic, while other pages may be initially mapped to a portionof main memory implemented using DRAM or other memory devices suitablefor handling a high volume of both read and write operations.

Data Structure for Managing Page Operations

FIG. 2 is a diagram illustrating an embodiment of a mapping module 200for managing page operations in a computer system having non-homogeneousmain memory. The mapping module 200 (e.g., TLB 132) includes entries 204for the most recently used pages in main memory 101. Each entry 204includes a field 206 for storing the physical address to which a virtualaddress maps and a usage field 208 (i.e., tag). More or fewer fields maybe included in the entries 204 of the mapping module 200 depending uponthe architecture of the computer system 100.

The usage field 208 stores data indicative of the usage model of thepage, which can be used by the processor 210 to exploit the uniqueattributes of a physical memory device associated with the main memoryaddress space 212. For example, when the processor 210 issues a writeoperation to page A (and page A is not currently stored in main memory101), then the usage field 208 for page A is read from a page tablecache or TLB. If the usage field 208 contains a logic ‘1’, then page Ais retrieved from the secondary storage 110 and written to a page frame(i.e., at a corresponding physical address) in a memory device (e.g., aFlash memory device) in the second portion 106 of main memory. If theusage field 208 contains a logic ‘0’, then page A is written to a pageframe in a memory device (e.g., DRAM) in the first portion 104 of mainmemory 101. Since pages B and C each have a logic ‘0’ in theirrespective usage fields 208, these pages will be written tocorresponding physical addresses in the first portion 104 of mainmemory.

In the above example, the usage field 208 is a one-bit flag thatindicates whether the requested page is expected to be read-only orwhether it is to be read-write. It should be apparent, however, that theusage field 208 can represent other page usage models, and include moreor fewer bits. In some embodiments, the usage field 208 includes a bitwhich is appended to the physical address (e.g., as a most significantbit or MSB). The MSB can then be decoded by decoder logic in theprocessor interface logic 122 to determine which portion of main memory101 will receive the page transaction.

Data Structure Initialization

In some embodiments, the usage field 208 for a page is set by hardwareand/or software contained within the system 100, or it could be set byhardware or software external to the system 100. For example, the valueto be stored in usage field 208 for a particular page can be determinedwhen the software stored in the page is compiled. Alternatively, thevalue to be stored in usage field 208 may be determined by the operatingsystem or by the system hardware at the time that the page istransferred from secondary storage 110 to main memory 101. In someembodiments, the usage field 208 is set or changed during operation ofthe system based on one or more events.

In some embodiments, a page of data or program code can be first movedinto the first portion 104 of main memory, and later moved to the secondportion 106 of main memory after it has been determined that no writeoperations are being directed to the page. This determination could bemade by, or with the assistance of, hardware (e.g., the memorycontroller 102) configured to keep usage data for each page of physicalmemory in the first portion 104 of main memory. The usage field 208 ofeach page in main memory 101 can be set based on the accumulated usagedata. Similarly, a virtual page can be first moved into the secondportion 106 of main memory, and later move to the first portion 104 ofmain memory if a write operation is directed to the page.

Process Flow

FIG. 3 is a flow diagram of an embodiment of a non-homogeneous memorymanagement process. The process flow is for a memory system in which afirst portion of main memory is implemented using DRAM memory device anda second portion of main memory is implemented using Flash memorydevice. It should be apparent, however, that more or fewer memory devicetypes can be used with the memory system, as needed, based on thearchitecture of the memory system.

The process begins by initializing 300 usage fields in a page tablelocated in secondary storage system and having a corresponding pagetable cache located near the processor core for storing the mostrecently used page table entries. The usage fields can be filled byinternal or external hardware and/or software. In alternativeembodiments, the usage fields are filled or changed based on a pageusage model (e.g., static or dynamic) or other trigger events (e.g.,power state transition). After the initialization phase is complete, thememory controller waits 302 for a read or write transaction request. Ifa read request is received, the virtual address is translated into aphysical address at step 304. The process for translating a virtualaddress to a physical address is discussed above. One aspect of step 304is reading the usage field for the page. If the usage field indicatesthat the page (i.e., the page containing the specified address fromwhich data is to be read) should be read from DRAM, then the data (whichmay contain program code) is read at step 306 from DRAM and returned tothe requestor. The process then returns to step 302 to wait for anotherread or write transaction request. If the usage field indicates that thepage containing the specified address should be read from Flash memory,then the data is read at step 308 from Flash memory and returned to therequestor, after which the process returns to step 302 to wait foranother read or write transaction request.

In an alternative embodiment (indicated by the dashed line), thephysical address is compared 320 with entries in a write cache. If thereis a match 322, the requested data is read 324 from the write cache andthe process returns to step 302 to wait for another transaction request.If there is no match 322, then the requested data is read from the Flashmemory and the process returns to step 302 to wait for anothertransaction request.

If the transaction request is a write request, the virtual address istranslated into a physical address at step 310, which once againincludes reading the usage field for the page containing the specifiedaddress. If the usage field indicates that the write data should writtento DRAM (i.e., to a first portion of main memory), then the write datais written to DRAM at step 318, and then the process returns to step 302to wait for another transaction request. If the usage field indicatesthat the write data should be written to Flash memory (i.e., to a secondportion of main memory), then an entry in an endurance tablecorresponding to the memory block containing the specified address ischecked 312. If the entry indicates that the number of read-write cyclesexceeds 314 a threshold, then a remedial action is taken 332, afterwhich the process returns to step 302 to wait for another transactionrequest. In some embodiments, the remedial action 332 is to remap thespecified page (i.e., the page containing the specified address) to theportion of main memory implemented using DRAM devices and then write thepage to DRAM. In some embodiments, the remedial action is to remap thespecified page to another page frame in the second portion of mainmemory (i.e., in the same portion of main memory as before). If thenumber of read-write cycles does not exceed 314 the threshold, then thewrite data is written to Flash memory and the corresponding endurancecounter is updated 316. The process then returns to step 302 for anotherread or write transaction request.

In embodiments that include a write cache (dashed line), theavailability of write cache capacity is checked 326 after performing thevirtual to physical address translation step 310. If the write cachealready has a valid entry for the block containing the address to whichdata is to be written, or if the write cache has an available block thatcan be used to store the block containing the address to which data isto be written, then the write data is written 328 to the write cache,and the process returns to step 302 for another page transactionrequest. If all the entries in the write cache that could be used tostore the block containing the specified address are occupied by otherblocks (326), then a swap operation is performed at step 330. Prior toperforming the swap operation, the write cache is in a state in which itcannot fully process the write operation. The swap operation willtypically include evicting one or more blocks of data from the writecache, writing the one or more evicted blocks of data to one or moreFlash memory devices in main memory so as to produce one or more freeentries in the write cache, and copying the specified block from Flashmemory into the write cache. The specified block is typically copiedfrom main memory to the write cache because the write operation willtypically modify only a small portion of the block, but when the blockis written back to main memory, the entire block must be written back tothe Flash memory device in main memory. The swap operation 330 frees upone or more entries in the write cache and may take a significant amountof time (e.g., 0.25 to 1.0 seconds). In some embodiments, the writecache may include a buffer for temporarily storing one or more writetransactions, and to thereby partially mask the latency associated withwriting a block of data evicted from the write cache back to a Flashmemory device. Once the swap operation is completed, the write data fromthe current write operation is written into an appropriate entry in thewrite cache 328.

In an alternate embodiment, when the write cache does not have an entryavailable for storing the write data from a write transaction, theassociated page is remapped to a page frame in another portion (e.g.,the DRAM portion) of main memory, and then write data is written to thatpage frame. In some embodiments, the latency associated with remappingand copying a page from Flash memory to DRAM may be considerably lessthan the latency associated with writing a block of data (evicted fromthe write cache) to a Flash memory device.

By using a write cache, write transactions to the Flash portion of mainmemory may be performed without actually performing a write transactionto the Flash memory devices. While most of the data in the write cachewill be written to a Flash memory device in the Flash portion of mainmemory, the average latency associate with write operations to the Flashportion of main memory is drastically reduced (e.g., typically by afactor of more than ten to 1) compared to the latencies that would beencountered when using a memory controller without a write cache.

The foregoing description, for purpose of explanation, has beendescribed with reference to specific embodiments. However, theillustrative discussions above are not intended to be exhaustive or tolimit the invention to the precise forms disclosed. Many modificationsand variations are possible in view of the above teachings. Theembodiments were chosen and described in order to best explain theprinciples of the invention and its practical applications, to therebyenable others skilled in the art to best utilize the invention andvarious embodiments with various modifications as are suited to theparticular use contemplated.

1. A controller, comprising: a first memory interface adapted to becoupled to one or more first memory devices wherein the first memorydevices comprise volatile memory devices; a second memory interfaceadapted to be coupled to one or more second memory devices wherein thesecond memory devices comprise non-volatile memory devices; andinterface logic coupled to the first and second interfaces andconfigured to direct memory transactions having a predefined firstcharacteristic to the first memory interface and to direct at least somememory transactions having a predefined second characteristic to thesecond memory interface, wherein the second characteristic comprises ausage characteristic selected from the group consisting of a read-mostlycharacteristic and read-only characteristic; and wherein the usagecharacteristic of at least some memory transactions is updated duringoperation.
 2. The controller of claim 1, wherein the second memorydevices have a limited write operation endurance.
 3. The controller ofclaim 2, further comprising: an endurance counter for counting a numberof write operations to a block of memory cells in the one or more secondmemory devices.
 4. The controller of claim 2, further comprising: a setof endurance counters for counting the number of write operations toeach block of memory cells in the one or more second memory devices. 5.The controller of claim 1, further comprising: a write cache for storingdata associated with write operations directed to any of the one or moresecond memory devices.
 6. The controller of claim 5, wherein the writecache is configured to write data stored therein to the one or moresecond memory devices when a predefined write cache state occurs.
 7. Thecontroller of claim 5, wherein the controller is configurable to writedata stored therein to the one or more second memory devices.
 8. Thecontroller of claim 5, wherein the controller is adapted to relocate oneor more pages from the one or more second memory devices to the one ormore first memory devices when a predefined write cache state occurs. 9.The controller of claim 1, wherein the one or more first memory devicesare Dynamic Random Access Memory (DRAM) devices and the one or moresecond memory devices are Flash memory devices.
 10. The controller ofclaim 1, further comprising: a prefetch buffer coupled to the secondmemory interface and adapted to prefetch data from the one or moresecond memory devices.
 11. The controller of claim 10, wherein thesecond memory interface is configured to reduce power used by the one ormore second memory devices between prefetches of data from the one ormore second memory devices.
 12. The controller of claim 1, wherein thememory controller is configurable to move pages from the one or morefirst memory devices to secondary storage and to then power down the oneor more first memory devices.
 13. The controller of claim 1, wherein thecontroller is adapted for use in conjunction with a processor havingvirtual memory logic for mapping virtual memory addresses into physicalmemory addresses and page logic for assigning physical memory addressesto virtual memory addresses, wherein the page logic is configured toassign physical memory addresses in the one or more first memory devicesto virtual memory addresses associated with a first usagecharacteristic, and to assign physical memory addresses in the one ormore second memory devices to virtual memory addresses associated with asecond usage characteristic.
 14. A controller, comprising: firstinterface means for coupling the controller to one or more first memorydevices wherein the first memory devices comprise volatile memorydevices; second interface means for coupling the controller to one ormore second memory devices wherein the second memory devices comprisenon-volatile memory devices; and logic means coupled to the first andsecond interface means for directing memory transactions having apredefined first characteristic to the first memory interface means andfor directing at least some memory transactions having a predefinedsecond characteristic to the second memory interface means, wherein thesecond characteristic comprises a usage characteristic selected from thegroup consisting of a read-mostly characteristic and read-onlycharacteristic, and wherein the usage characteristic of at least somememory transactions is updated during operation.
 15. A system,comprising: a first memory interface adapted to be coupled to one ormore first memory devices of a first memory type having a first set ofattributes; a second memory interface adapted to be coupled to one ormore second memory devices of a second memory type having a second setof attributes, wherein the first and second sets of attributes have atleast one differing attribute; interface logic coupled to the first andsecond interfaces and configured to direct memory transactions having apredefined first characteristic to the first memory interface and todirect memory transactions having a predefined second characteristic tothe second memory interface; and a processor having virtual memory logicfor mapping virtual memory addresses into physical memory addresses andpage logic for assigning physical memory addresses to virtual memoryaddresses, wherein the page logic is configured to assign physicalmemory addresses in the one or more first memory devices to virtualmemory addresses associated with a first usage characteristic, and toassign physical memory addresses in the one or more second memorydevices to virtual memory addresses associated with a second usagecharacteristic.
 16. The system of claim 15, wherein the first usagecharacteristic comprises memory usage that includes both read and writeoperations.
 17. The system of claim 16, wherein the second usagecharacteristic comprises memory usage that includes only readoperations.
 18. The system of claim 16, wherein the second usagecharacteristic comprises memory usage that includes read operations andless than a threshold amount of write operations.
 19. The system ofclaim 15, wherein the processor includes a page table cache havingentries that include a field whose value is set by the processor inaccordance with the first and second usage characteristics.
 20. Thesystem of claim 15, including a page table, for mapping virtual memorypages to physical memory pages, having a plurality of entries thatinclude a field whose value is set in accordance with whethercorresponding virtual memory pages are associated with the first orsecond usage characteristic.
 21. The system of claim 20, wherein thesystem is configured to change the value of the field in an entry of thepage table based on usage of the corresponding page.
 22. A system,comprising: first interface means for coupling to one or more firstmemory devices of a first memory type having a first set of attributes;second interface means for coupling to one or more second memory devicesof a second memory type having a second set of attributes, wherein thefirst and second sets of attributes have at least one differingattribute; logic means coupled to the first and second interface meansfor directing memory transactions having a predefined firstcharacteristic to the first interface means and to direct memorytransactions having a predefined second characteristic to the secondinterface means; and virtual memory means for mapping virtual memoryaddresses into physical memory addresses and page means for assigningphysical memory addresses to virtual memory addresses, wherein the pagemeans assigned physical memory addresses in the one or more first memorydevices to virtual memory addresses associated with a first usagecharacteristic, and assigns physical memory addresses in the one or moresecond memory devices to virtual memory addresses associated with asecond usage characteristic.
 23. A method of managing memory in anon-homogeneous memory system, comprising: establishing a plurality ofpage table entries, each entry in the plurality of page table entriesmapping a virtual memory page address to a physical memory page address,each said entry including a usage field identifying a respective portionof main memory in which the physical memory page address is located,wherein the main memory includes at least two distinct portions,including a first portion implemented with one or more first memorydevices of a first memory type having a first set of attributes and asecond portion implemented with one or more second memory devices of asecond memory type having a second set of attributes, wherein the firstand second sets of attributes have at least one differing attribute;receiving a memory transaction request; translating a virtual address ofa page associated with the memory transaction request into a physicaladdress in accordance with a corresponding page table entry of theplurality of page table entries, the physical address comprising aphysical address in a respective portion of main memory; directing thememory transaction to the physical address in the respective portion ofmain memory.
 24. The method of claim 23, wherein the first memorydevices are volatile memory devices, the first set of attributes includean unlimited endurance characteristic, the second memory devices arenon-volatile memory devices, and the second set of attributes include alimited endurance characteristic.
 25. The method of claim 23, whereinthe second memory devices are non-volatile memory devices and the firstmemory devices are volatile memory devices.
 26. The method of claim 23,further comprising: determining if an endurance limitation associatedwith one of the second memory devices has been exceeded; and redirectingthe memory transaction if the endurance limitation not been exceeded.27. The method of claim 23, wherein the second memory devices arenon-volatile memory devices, and the method includes: redirecting atleast one write operation directed to one of the second memory devicesto a write cache.
 28. The method of claim 27, further comprising:determining if the write cache can accept a write operation; and writingthe page to the write cache if the write cache can accept a writeoperation.
 29. The method of claim 23, wherein the second memory devicesare non-volatile memory devices and the method includes: pre-fetchingdata from the second memory device.
 30. The method of claim 29,including reducing power to the one or more second memory devicesbetween prefetches.
 31. The method of claim 23, including moving pagesfrom the one or more first memory devices to secondary storage and thenpowering down the one or more first memory devices.